import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import router from './router';
import { useUserStore } from './stores/user';
// 按需引入 Vant 组件
import {
  Search,
  Tabbar,
  TabbarItem,
  Button,
  Sidebar,
  SidebarItem,
  Image as VanImage,
  Grid,
  GridItem,
  Skeleton,
  Form,
  Field,
  CellGroup,
  SwipeCell,
  Stepper,
  Card,
  Swipe,
  SwipeItem,
  ActionBar,
  ActionBarIcon,
  ActionBarButton,
  Lazyload,
  Popup,
  AddressEdit,
  Area,
  SubmitBar,
  ActionSheet,
  PasswordInput,
  NumberKeyboard,
  AddressList,
  CouponCell,
  CouponList,
  CountDown,
  Icon,
  Loading,
  NavBar,

  ShareSheet ,
} from 'vant'; // 按需引入
import 'vant/lib/index.css'; // 引入 Vant 样式

const app = createApp(App);
const pinia = createPinia(); // 创建 Pinia 实例

// 注册 Pinia 实例
app.use(pinia);
app.use(Loading);
// 注册其他插件和 Vant 组件（按需引入）
app.use(Lazyload);
app.use(router);
app.use(Button);
app.use(Tabbar);
app.use(TabbarItem);
app.use(Search);
app.use(Sidebar);
app.use(SidebarItem);
app.use(VanImage);
app.use(Grid);
app.use(GridItem);
app.use(Skeleton); // 骨架屏
app.use(Form);
app.use(Field);
app.use(CellGroup);
app.use(SwipeCell);
app.use(Stepper);
app.use(Card);
app.use(ActionSheet);
app.use(Stepper);
app.use(Swipe);
app.use(SwipeItem);
app.use(ActionBar);
app.use(ActionBarIcon);
app.use(ActionBarButton);
app.use(NavBar);
//弹出层
app.use(Popup);
//地址编辑
app.use(AddressEdit);
app.use(Area);
app.use(AddressList);
//提交订单
app.use(SubmitBar);
app.use(SwipeCell);

// 显式注册 van-icon
app.component('van-icon', Icon);

//密码输入框
app.use(PasswordInput);
app.use(NumberKeyboard);
//优惠券
app.use(CouponCell);
app.use(CouponList);
app.use(CountDown );
app.use(Icon );
//分享
app.use(ShareSheet );
// 挂载 Vue 应用
app.mount('#app');
